package com.gf.snoopy.platform.result;

import net.sf.json.JSONObject;

public class PokeResult {
	
	private Integer flag;
	
	private Integer errorCode;
	
	private String msg;
	
	private Object data;
	
	private static final Integer FAIL = 1;
	
	private static final Integer SUCCESS = 0;
	
	private PokeResult(){
		
	}
	
	public static String getPokeResultFail(Integer errorCode,String msg){
		PokeResult poke = new PokeResult();
		poke.setFlag(FAIL);
		poke.setMsg(msg);
		poke.setErrorCode(errorCode);
		return JSONObject.fromObject(poke).toString();
	}
	
	public static String getPokeResultSuccess(Object data){
		PokeResult poke = new PokeResult();
		poke.setFlag(SUCCESS);
		poke.setData(data);
		return JSONObject.fromObject(poke).toString();
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	public Integer getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(Integer errorCode) {
		this.errorCode = errorCode;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
